package edu.pku.sei.transformation.tgg.adapter;

import edu.pku.sei.transformation.editor.model.variable.ConnectionVariable;
import edu.pku.sei.transformation.tgg.rule.IEdge;
import edu.pku.sei.transformation.tgg.rule.INode;
import edu.pku.sei.transformation.tgg.rule.IPattern;

public class EdgeAdapter implements IEdge {
	ConnectionVariable element;
	public INode source;
	public INode target;
	IPattern owner;
	
	public EdgeAdapter(ConnectionVariable element, IPattern owner, INode source, INode target) {
		this.element = element;
		this.owner = owner;
		this.source = source;
		this.target = target;
	}
	@Override
	public IPattern getPattern() {
		return owner;
	}

	@Override
	public INode getSource() {
		return source;
	}

	@Override
	public INode getTarget() {
		return target;
	}

	@Override
	public String getType() {
		return source.getType()+"/"+element.getTargetRole();
	}

	@Override
	public String getID() {
		return String .valueOf(element.getElementID());
	}

}
